//
//  h.swift
//  IMSDKDemo
//
//  Created by FungYan on 2022/5/5.
//

import Foundation
import WeCloudTRTC
import WeCloudIMSDK
import UIKit

public class Answer: NSObject{
    
    @objc public func open(VC :UIViewController,roomID : String,token: String) -> Void{
        let liveVC =  RoomListener.init(cv: VC,
                                        camera: true,
                                        mute: true,
                                        loud: true,
                                        url: "wss://ws-meet-test.wecloud.cn",
                                        roomId: roomID,
                                        token: token)
        
        
        liveVC.leaveBlock = {
            roomId in
            print("主动离开房间")
            
            WeCloudTRTCApi.leaveRoomId(roomId) {success, apiResult in
                if success{
                    DispatchQueue.main.async(){
                        if success{
                            VC .dismiss(animated: true);
                        }
                    }
                }
            }
        }
        
        liveVC.inviteBlock = {
            roomId in
            print("邀请多人进行音视频")
        }
    }
    
}




